File
An object of class File can be any file on a disk, including document files, application files, and so on.PROPERTIES
A file has all the properties defined for object class Item on page 72: Bounds, Comment, Container, Content Space, Creation Date, Disk, Folder, Icon, ID, Information Window, Kind, Label Index, Modification Date, Name, Physical Size, Position, Selected, Size, and Window.Unlike other items, a file also has these properties:
creator type
- A four-character code that indicates the creator type of the application that created the file.
Class: String
Modifiable: Yesfile type
- A four-character code that indicates the type of the file.
Class: String
Modifiable: Yeslocked
- A Boolean value that indicates whether the file is locked (
true
) or not (false
).
Class: Boolean
Modifiable: Yesproduct version
- The version number shown at the top of the information window for the file.
Class: String
Modifiable: Nostationery
- A Boolean value that indicates whether the file is a stationery pad (
true
) or not (false
).
Class: Boolean
Modifiable: Yesversion
- The version number shown near the middle of the information window for the file.
Class: String
Modifiable: NoELEMENT CLASSES
NoneCOMMANDS HANDLED
Clean Up, Copy, Count, Data Size, Delete, Duplicate, Exists, Get, Make, Move, Open, Print, Put Away, Reveal, Select, Sort, UpdateDEFAULT VALUE CLASS RETURNED
A reference to a file or, if you use the plural formfiles
, a list of references.EXAMPLES
This script returns a list of references to the files whose modification dates are greater than a specified date:
tell application "Finder" files of startup disk whose modification date > ¬ date "November 18, 1993"end tellIf you save this script as a script application, it copies a new icon to any files whose icons you drop on the script's icon. The script uses the scripting addition command Choose File to ask the user to specify which file's icon is to be copied:
on open x tell application "Finder" choose file with prompt ¬ "Choose the file whose icon you want to copy:" set newIcon to icon of the result repeat with i in x set the icon of i to newIcon end repeat end tell end open